﻿package {
	import flash.display.Shape;
	import flash.events.Event;
	import flash.geom.Rectangle;
	import idv.cjcat.pyronova.nodes.Draw;
	import idv.cjcat.pyronova.nodes.FillRect;
	import idv.cjcat.pyronova.nodes.Group;
	import idv.cjcat.pyronova.nodes.Node;
	
	public class Main extends PyronovaExample {
		
		private var draw:Node;
		
		public function Main():void {
			super("Simple Draw");
		}
		
		override protected function buildPreprocessor():Node {
			//clean buffer
			return new FillRect(view.bitmapData().rect, 0x00000000);
		}
		
		override protected function buildRoot():Node {
			var square:Shape = new Shape();
			square.graphics.lineStyle(2, 0x505050);
			square.graphics.drawRect(0, 0, 24, 24);
			
			//draw square
			draw = new Draw(square);
			draw.center.set(12, 12);
			draw.position.set(160, 100);
			
			return draw;
		}
		
		override protected function mainLoop():void {
			++draw.rotation;
		}
	}
}